package coins;

//~--- non-JDK imports --------------------------------------------------------

import com.dukascopy.api.IAccount;
import com.dukascopy.api.IContext;
import com.dukascopy.api.IStrategy;
import com.dukascopy.api.ITick;
import com.dukascopy.api.Instrument;
import com.dukascopy.api.JFException;
import com.dukascopy.api.Period;
import com.dukascopy.api.system.Overnights;

//~--- JDK imports ------------------------------------------------------------

import java.sql.Connection;

import java.util.Currency;
import java.util.HashSet;
import java.util.Set;

public class Account implements IAccount {
    private Instrument instrument = Instrument.EURUSD;
    private IContext   context;
    private Currency   currency;
    private double     currentDeposit;
    private double     drawdown;
    private double     initialDeposit;
    private int        leverage;
    private int        marginCutLevel;
    private double     mcEquity;
    private Overnights overnights;

    Account(Currency currency, double initialDeposit, int leverage) {
        this.currency       = currency;
        this.initialDeposit = initialDeposit;
        this.leverage       = leverage;
        this.currentDeposit = initialDeposit;
    }

    @Override
    public Currency getCurrency() {

        // TODO Auto-generated method stub
        return currency;
    }

    @Override
    public double getEquity() {

        // TODO Auto-generated method stub
        return currentDeposit;
    }

    @Override
    public double getLeverage() {

        // TODO Auto-generated method stub
        return leverage;
    }

    @Override
    public double getUseOfLeverage() {

        // TODO Auto-generated method stub
        return 0;
    }

    @Override
    public double getCreditLine() {

        // TODO Auto-generated method stub
        return 0;
    }

    @Override
    public int getMarginCutLevel() {

        // TODO Auto-generated method stub
        return 0;
    }

    @Override
    public int getOverWeekEndLeverage() {

        // TODO Auto-generated method stub
        return 0;
    }

    @Override
    public boolean isGlobal() {

        // TODO Auto-generated method stub
        return false;
    }

    @Override
    public String getAccountId() {

        // TODO Auto-generated method stub
        return null;
    }

    @Override
    public Set<String> getClientIds() {

        // TODO Auto-generated method stub
        return null;
    }

    public void updateCurrentDeposit(double amount) {
        currentDeposit += amount;

        if (currentDeposit < 0) {
            throw new RuntimeException();
        }
    }

    public void calculateDrawdown() {
        if (currentDeposit < initialDeposit) {
            if ((currentDeposit - initialDeposit) < drawdown) {
                drawdown = currentDeposit - initialDeposit;
            }
        }
    }

    public double getDrawdown() {
        return drawdown;
    }
}


//~ Formatted by Jindent --- http://www.jindent.com
